package com.translate.web.api.controller;

import java.util.List;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.param.impl.IdParam;
import com.response.vo.ResponseModel;
import com.translate.vo.ActivityManagerVO;
import com.translate.web.service.IActivityManagerService;

@RestController
@RequestMapping("activityManager")
public class ActivityManagerController {
	private IActivityManagerService service;


	public ActivityManagerController(IActivityManagerService service) {
		this.service = service;
	}
	
	/**
	 * 活动
	 * @param param
	 * @return
	 */
	@PostMapping("/listActivitys")
	public ResponseModel<List<ActivityManagerVO>> listActivitys() {
		
		return ResponseModel.<List<ActivityManagerVO>>success(this.service.getListFromCache(ActivityManagerVO.class));
	}
	
	/**
	 * 活动文章
	 * @param param
	 * @return
	 */
	@PostMapping("/getArticle")
	public ResponseModel<ActivityManagerVO> getArticleById(@RequestBody @Validated IdParam param) {
		
		return ResponseModel.<ActivityManagerVO>success(this.service.getArticleById(param.getId(), ActivityManagerVO.class));
	}

}